#!/usr/bin/env python2
from scapy.all import *
from sys import argv, exit

if not 2 <= len(argv) <= 3:
    print "usage: ./arp.py <ip> [timeout=0.1]"
    sys.exit(0)

p = Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=argv[1])
for i in srp(p, timeout=0.1 if len(argv) != 3 else float(argv[2]))[0]:
    print i[1].psrc,'\t', i[1].hwsrc
